home *** CD-ROM | disk | FTP | other *** search
- Path: mail2news.demon.co.uk!gate.demon.co.uk
- From: "Paul F. Robinson" <pfr@doodey.demon.co.uk>
- Newsgroups: comp.lang.c
- Subject: Re: Checking to See if a File Exists
- Date: Sun, 28 Jan 96 14:12:53 GMT
- Organization: Private node
- Message-ID: <9601281412.AA0001c@doodey.demon.co.uk>
- References: <DLtI7G.HpE@midway.uchicago.edu>
- X-NNTP-Posting-Host: gate.demon.co.uk
- X-Newsreader: TIN [AMIGA 1.3 950726BETA PL0]
- X-Mail2News-Path: relay-1.mail.demon.net!gate.demon.co.uk
-
- josef jurek (jaj3@kimbark.uchicago.edu) wrote:
- :
- : How does one check from a C program to see whether a file
- : exists or not?
-
- Your compiler library might have an access() function.
- Alternatively,
- attempt to open the file with fopen().
- If successful, the file exists. -Don't forget to fclose() it.
- If unsuccessful, check the value of errno. ENOENT (from errno.h)
- indicates that the file does not exist.
-
- Paul.
-
-